/**   
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2020-03-17 14:00:30  
 * Copyright (c) 2015- -版权所有     
 */

package com.joysuch.wwyt.edu.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_edu_trainning_record_user")
@SQLDelete(sql = "update wwyt_edu_trainning_record_user set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_edu_trainning_record_user set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
@Proxy(lazy = false)
@TableName(value = "wwyt_edu_trainning_record_user")
public class EduTrainningRecordUser implements java.io.Serializable {

    // columns START
    @Id
    @GeneratedValue(strategy = IDENTITY)

    // ID
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    // 培训记录ID
    @Column(name = "TRAINNING_RECORD_ID")
    private Long trainningRecordId;

    // 人员ID
    @Column(name = "USER_ID")
    private Long userId;

    // 部门名称
    @Column(name = "DEPART_NAME", length = 50)
    private String departName;

    // 部门ID
    @Column(name = "DEPART_ID")
    private Long departId;

    // 岗位名称
    @Column(name = "JOB_NAME", length = 50)
    private String jobName;

    // 岗位ID
    @Column(name = "JOB_ID")
    private Long jobId;

    // 考试分数
    @Column(name = "SCORE")
    private String score;

    // 培训结果
    @Column(name = "TRAINNING_RESULT", length = 2)
    private String trainningResult;

    // 效果评估
    @Column(name = "EVALUATION", length = 2)
    private String evaluation;

    // 创建人
    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    private Long createBy;

    // 创建时间
    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    private java.util.Date createTime;

    // 更新人
    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    private Long updateBy;

    // 更新时间
    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    private java.util.Date updateTime;

    // 删除标记
    @Column(name = "DELETE_FLAG", length = 2)
    private String deleteFlag;

    // 组织机构代码
    @Column(name = "ORG_CODE", length = 100)
    private String orgCode;

    // 租户
    @Column(name = "TENENT_ID")
    private Long tenentId;
    // columns END
    // 证书记录ID
    @Column(name = "CERT_USER_ID")
    private Long certUserId;

    //是否签到0否1是
    @Column(name = "HAS_SIGN_IN")
    private Integer hasSignIn;

    //人员/承包商人员flag 0: 人员; 1 承包商人员
    private Integer userContractorFlag;
    //培训人员名称
    private transient String userName;
    //培训时间总和
    private transient Double trainTimeSum;
    //筛选时间段，开始时间
    private transient Date beginTime;
    //筛选时间段，结束时间
    private transient Date endTime;

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof EduTrainningRecordUser == false)
            return false;
        if (this == obj)
            return true;
        EduTrainningRecordUser other = (EduTrainningRecordUser) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
